package logic

import (
	"context"
	"rikao9/model/model"

	"rikao9/rikao9rpc/internal/svc"
	"rikao9/rikao9rpc/rikao9rpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type CptChaLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCptChaLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CptChaLogic {
	return &CptChaLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CptChaLogic) CptCha(in *rikao9rpc.CptChaRequest) (*rikao9rpc.CptChaResponse, error) {
	// todo: add your logic here and delete this line

	var users model.User
	model.DB.Where("phone=?", in.Phone).Debug().Find(&users)
	
	c := base64Captcha.NewCaptcha(base, store)
	id, b64s, err := c.Generate()

	return &rikao9rpc.CptChaResponse{}, nil
}
